{% extends "base_generic.html" %}
{% load static %}
{% block extra_css %}
<link rel="stylesheet" href="{% static 'css/user_management.css' %}">
{% endblock %}

{% block content %}
<div class="container mt-4">
    <h1 class="text-center mb-4"><i class="fas fa-book"></i> 我借的书籍</h1>
    
    <div class="card">
        <div class="card-header">
            <h2 class="mb-0">借阅记录</h2>
        </div>
        
        <div class="card-body">
            {% if bookinstance_list %}
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th scope="col">书名</th>
                        <th scope="col">归还日期</th>
                        <th scope="col">状态</th>
                    </tr>
                </thead>
                <tbody>
                    {% for bookinst in bookinstance_list %}
                    <tr class="{% if bookinst.is_overdue %}table-danger{% endif %}">
                        <td><i class="fas fa-book"></i> <a href="{% url 'book-detail' bookinst.book.pk %}">{{bookinst.book.title}}</a></td>
                        <td>{{ bookinst.due_back }}</td>
                        <td>{% if bookinst.is_overdue %}已逾期{% else %}正常{% endif %}</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
            {% else %}
            <p>您没有借出任何书籍。</p>
            {% endif %}
        </div>
    </div>
</div>
{% endblock %}